# load package----library(tidyverse)library(patchwork)library(kableExtra)library(gtsummary)library(FactoMineR)library(glmmTMB)library(factoextra)# load data ---- res_by_ind_spatial <-read.delim("../Data_larvae/data_larves_1hr/Results/Spatial/Element_Tous_bords_0.csv", ,sep =";") %>%separate(Video, c("Camera", "FPS", "Replicat"), remove=FALSE)res_by_ind <-read.delim("../Data_larvae/data_larves_1hr/Results/Results_by_ind.csv", ,sep =";") %>%separate(Video, c("Camera", "FPS", "Replicat"), remove=FALSE) %>%select(!c(25:29))corres_ID <-read_csv2("../Corr_coord_data/corres_Arena_ID.csv") %>%select(c(1,2))corres_ttmt <-read_csv2("../corr_traitement_plaque.csv")%>%select(c(1:4))## ID attribution corres_ID <- corres_ID %>%mutate(Arena=as.numeric(str_extract(Arena, "\\d.*")))res_by_ind <- res_by_ind %>%inner_join(corres_ID) res_by_ind <- res_by_ind %>%mutate(Plaque=as.numeric(str_extract(ID, "\\d+"))) %>%inner_join(corres_ttmt) %>%mutate(End_seq_min=as.numeric(End_seq)/60) %>%mutate(fullID =str_c(Camera, Replicat, ID))res_by_ind_spatial <- res_by_ind_spatial %>%inner_join(corres_ID) res_by_ind_spatial <- res_by_ind_spatial %>%mutate(Plaque=as.numeric(str_extract(ID, "\\d+"))) %>%inner_join(corres_ttmt)%>%mutate(fullID =str_c(Camera, Replicat, ID))# taille des larves taille_larv <-read.csv("../Data_larvae/20240820_mesures_larves.csv")# metadata metadata <-read_csv2("../Data_larvae/20240807_meta_data.csv")metadata <- metadata %>%separate(ID, c("Camera", "ID2")) metadata <- metadata %>%mutate(Camera=str_to_lower(Camera), fullID=paste0(Camera,ID2))# tri des id qui sont en LAM # suppresion des ID qui sont pas dans les LAM et virer le replicat 05metadata_sub <- metadata %>%drop_na(position_LAM) %>%filter(replicat!=5)data_LAM_vid_spatial <-inner_join(metadata_sub, res_by_ind_spatial)data_LAM_vid <-inner_join(metadata_sub, res_by_ind, by=c("Camera","fullID"))data_LAM_vid <- data_LAM_vid %>%mutate(fullID2=paste0(Arena, fullID)) %>%mutate(fullID3=gsub("[^0-9]", "", as.character(fullID2)))res_bout_Mspeed<-read_csv("../Data_larvae/data_larves_1hr/res_bouts_Mspeed.csv") %>% dplyr::select(!1) %>%mutate_at(vars(Max_bout_activ, Max_bout_inactiv, Max_Speed), as.numeric)data_LAM_vid <-data_LAM_vid %>%inner_join(res_bout_Mspeed)
Ce script présente les analyses concernant les données video acquise dans le cadre du projet ANR INDeed. Les analyses sont ici basée sur tous les individus filmé dont la proportion de temps de tracking perdu est inférieur à 20% et qui dont l’activité en LAM a pu être enregistrée.
Video acquisition
The video were acquiried with a setup described in detail in supplementary data. Basically, it is based on RapsberryPi 4 and a camera IR cut with an objective of 2.8cm focus. Image are acquired at 10fps rate.
Video tracking parameters
All the tracking was made using AnimalTA software (source). The step of plate installation was removed from the video. The length of the video was limited to 3600 s for each replicate. Relative background substraction method was applied (hungarian algo I think, need to validate this). Arena were defined by hand.
Parameters needed to do the tracking with the software :
color correction : none, keep original color.
correction of light : yes
Threshold : 19-30 depending on the video
Background : relative background substraction with individual darker than background.
Max distance : 3.5-3.7 cm
Erosion/dilatation : 0
Surface : 56.8cm2
Nb ID by arena : 1
Analysis
Analysis description
This document contains a description of the video data of larvae Anopheles gambiae s.s. kdr mutant L3-L4 stage.
Analysis are based on parameters that described the navigatory behaviour of larvae during 1 hour in a circle containers (3cm diameter). Analysis was made on 3 sequences : 1/ complete 1 hour, 2/ time needed to explore 90% of the surface and 3/ 90% of exploration to the end of recording (3600s). All video were cropped to have the same time lenght.
Analysis is divided in two mains parts :
- Analysis of results of navigation in the total of the container surface
- Analysis of results in the surface close to border (1 cm to the border).
Number of individuals
Code
data_LAM_vid%>%filter(Sequence=="General") %>%drop_na(traitement) %>%group_by(traitement) %>%summarise(Nmosquitoes=n()) %>%kbl(caption ="Number of mosquitoes larvae tracked and LAM acquisition for each treatment", booktabs = T)%>%kable_styling(full_width = T)
Number of mosquitoes larvae tracked and LAM acquisition for each treatment
traitement
Nmosquitoes
eau
76
perm
77
Code
data_LAM_vid%>%filter(Sequence=="General"& Prop_time_lost <0.20) %>%group_by(traitement) %>%summarise(Nmosquitoes=n()) %>%kbl(caption ="Number of mosquitoes with less than 20% of time lost during tracking and LAM acquisition for each treatment", booktabs = T)%>%kable_styling(full_width = T)
Number of mosquitoes with less than 20% of time lost during tracking and LAM acquisition for each treatment
traitement
Nmosquitoes
eau
72
perm
71
Code
data_LAM_vid %>%filter(Sequence=="General"& Prop_time_lost <0.20) %>%group_by(Replicat, Traitement) %>%summarise(Nmosquitoes=n()) %>%kbl(caption ="Number of mosquitoes with less than 20% of time lost during tracking for each replicate and treatment", booktabs = T)%>%kable_styling(full_width = T)
Number of mosquitoes with less than 20% of time lost during tracking for each replicate and treatment
Replicat
Traitement
Nmosquitoes
R06
Control
10
R06
Permethrin
9
R08
Control
8
R08
Permethrin
8
R09
Control
16
R09
Permethrin
18
R10
Control
19
R10
Permethrin
19
R11
Control
17
R11
Permethrin
19
Code
# data_LAM_vid %>% filter(Sequence=="General" & Prop_time_lost < 0.20) %>% # dplyr::select(Replicat, Traitement, fullID3) %>% # # kbl(caption = "Number of mosquitoes with less than 20% of time lost during tracking for each replicate and treatment", booktabs = T)%>%# #kable_styling(full_width = T) %>% # data_frame() %>% # write.csv("../ID_selected_MoveR.csv")data_LAM_vid%>%filter(Sequence=="General"& Prop_time_lost <0.20) %>%group_by(Traitement, sexe) %>%summarise(Nmosquitoes=n()) %>%kbl(caption ="Number of mosquitoes with less than 20% of time lost during tracking for each replicate and treatment", booktabs = T)%>%kable_styling(full_width = T)
Number of mosquitoes with less than 20% of time lost during tracking for each replicate and treatment
Traitement
sexe
Nmosquitoes
Control
F
39
Control
M
29
Control
NA
2
Permethrin
F
35
Permethrin
M
31
Permethrin
NA
7
Number of individual alive until LAM for each treatement and replicate
Code
# estimation of number alive until LAM for water and permethrin exposition metadata %>% dplyr::filter(replicat!=5& replicat!=7) %>% dplyr::group_by(replicat,traitement) %>% dplyr::filter(LAMetsurv==1) %>%summarise(n=n()) %>%kbl(caption ="Number of mosquitoes alive until LAM recording", booktabs = T)%>%kable_styling(full_width = T)
Number of mosquitoes alive until LAM recording
replicat
traitement
n
6
eau
15
6
perm
14
8
eau
14
8
perm
14
9
eau
13
9
perm
14
10
eau
12
10
perm
9
11
eau
12
11
perm
11
Variables description
Parameters are calculated for all displacement inside the containers (named after dataset_all) and inside the zone defined along border of each containers (spatial). I choose a zone of 1cm to the border. Graphics and analysis were presented for each set of parameters (all or spatial).
Threshold for movement : Here the threshold is defined as the distance traveled between two frames higher than 0.3cm corresponding to the L3_L4 larvae body size.
Variables description
Variable Name
Description
Units
Type of bhvr
Dataset
Prop_time_lost
Count the proportion of frames for which the target was not detected (appears as “NA NA” in the data tables).
No units
NA
Both
Average_Speed
The displacement speed between each frame will be calculated and averaged for the whole video/or sequence length defined.
cm/frame
activity
Both
Average_Speed_Moving
The displacement speed between each frame where the target is considered as moving (i.e. speed above the red movement threshold) will be calculated and averaged for the whole video.
cm/frame
Both
Prop_time_moving
Proportion of time the target is considered as moving given the defined threshold.
No units
activity
Both
Traveled_Dist
Sum the total distance traveled by the target.
cm
activity/exploration
Both
Traveled_Dist_Moving
Sum the total distance traveled by the target when we only consider the frame during which the target is considered as moving.
cm
activity.
Both
End_seq
Time needed to explore 90% of the surface. Length of the sequence. (Manually defined, other option are available in AnimalTA software). (s)
second
exploration
Ind_all
Prop_time_inside
Proportion of time inside the area, here in an area of 3mm along border.
No units
foraging
Spatial
Time_inside
Number of frame (s?) inside 3mm close to border.
seconds ?
foraging
Spatial
Nb_entries
Nb of the entries in the area of 3mm close to border
No units
foraging
Spatial
Exploration_absolute_value
surface in cm2 explored by the larvae in a given time (here 1 hour or End_seq time length).
cm2
exploration (time dependant)/ not really relevant for our study as we let enough time given the container to explore all the surface
ind_all
Meander
Indicator of the sinusoity of the trajectories during the sequence recorded. Estimation of the meander of the trajectories. This value is the average of the change in direction (turning angle) divided by the distance traveled for each frame.
foraging
Both
Meander_moving
same as Meander but only for movement
Foraging ?
Both
Latency
The latency to approach the border(s) at less than the indicated distance (1cm here)
Rest ?
Spatial
Max_bout_inactiv
Maximal length (in frame) without movement >0.3cm/s
physiological/activity intensity
ind_all
Max_speed
Maximal speed recorded (cm/s)
physiological/activity intensity
ind_all
Need precision about :
The method for speed average ? (moyenne glissante ? geométrique ?)
Units of Time inside frame or second ?
All detailed informations are available in software AnimalTA and associated guidelines.
All surface analysis
1 hour recording
The data presented are data for the whole recording and for individuals with less than 20% of time lost during recording.
# Table of mean, sd and median data_temp %>%tbl_summary(include = loop.list,by=Traitement,type = loop.list ~"continuous2",statistic =all_continuous2() ~c("{median} ({p25} - {p75}", "{mean} ({sd})"),digits =list(all_continuous2() ~2) )
Characteristic
Control
N = 70
Permethrin
N = 73
Prop_time_moving
Median (Q1 - Q3
0.28 (0.21 - 0.36
0.29 (0.21 - 0.35
Mean (SD)
0.28 (0.11)
0.29 (0.09)
Average_Speed
Median (Q1 - Q3
0.33 (0.25 - 0.44
0.33 (0.25 - 0.43
Mean (SD)
0.35 (0.13)
0.34 (0.12)
Average_Speed_Moving
Median (Q1 - Q3
1.05 (0.96 - 1.15
1.03 (0.95 - 1.12
Mean (SD)
1.05 (0.15)
1.03 (0.14)
Traveled_Dist
Median (Q1 - Q3
1,163.38 (859.57 - 1,479.42
1,093.21 (810.23 - 1,445.17
Mean (SD)
1,193.96 (473.66)
1,168.82 (417.47)
Meander
Median (Q1 - Q3
31,743.01 (22,121.90 - 253,016,104,325.86
32,492.45 (21,057.91 - 44,292.84
Mean (SD)
2,312,546,440,481.70 (5,206,061,772,258.69)
1,316,422,157,636.93 (5,167,609,238,377.32)
Traveled_Dist_Moving
Median (Q1 - Q3
997.95 (705.46 - 1,292.63
933.69 (670.09 - 1,288.14
Mean (SD)
1,036.35 (459.06)
1,008.02 (399.06)
Meander_moving
Median (Q1 - Q3
199.27 (184.63 - 213.97
196.69 (181.97 - 207.32
Mean (SD)
204.01 (33.28)
196.10 (26.36)
Max_bout_inactiv
Median (Q1 - Q3
344.50 (216.00 - 565.00
355.00 (237.00 - 522.00
Mean (SD)
446.37 (362.98)
417.60 (280.41)
Max_Speed
Median (Q1 - Q3
7.96 (7.03 - 9.91
7.81 (6.67 - 9.06
Mean (SD)
9.47 (5.14)
9.33 (5.32)
90% exploration
In this part are presented metrics for only the period taken to explore 90% of the area. As previously, individual with more than 20% of time lost are removed.
Analysis of impact of permethrin exposition on each parameters calculated.
Parameters 90% exploration
Parameters that we can consider they follow a gaussian (approx) for parameters extracted from 90% needed to explore environement. Given the mean estimation and SD, statistical test are almost not needed to confirm that there are no difference between groups. I have just done lm or glm for code simplicity, but classic t-test or equivalent are also an option.
Code
library(glmmTMB)library(broom.mixed)data_glm <- data_temp2 %>%mutate_if(is.character, as.factor)data_glm %>% dplyr::select(loop.list2[-1]) %>%# enleve la var binomialemap(~hist(.x), xlab=.x)
RLS_table <- data_glm %>% dplyr::select(loop.list2[-1]) %>%# enleve la var binomialemap(~glmmTMB(.x ~ Traitement, data = data_glm))%>%map_dfr(~tidy(., effects ="fixed"), .id ='source')%>% dplyr::filter(term!="(Intercept)") %>%arrange(p.value) %>%kbl(caption ="Coefficient of linear model for each parameters", booktabs = T) %>%kable_styling(full_width = T)RLS_table
Coefficient of linear model for each parameters
source
effect
component
term
estimate
std.error
statistic
p.value
End_seq
fixed
cond
TraitementPermethrin
-83.6521625
34.4767125
-2.4263381
0.0152521
Average_Speed
fixed
cond
TraitementPermethrin
0.0429863
0.0178336
2.4104030
0.0159349
Meander_moving
fixed
cond
TraitementPermethrin
-49.2863855
40.1860576
-1.2264549
0.2200276
Traveled_Dist_Moving
fixed
cond
TraitementPermethrin
2.6883884
2.7294162
0.9849683
0.3246396
Exploration_absolute_value
fixed
cond
TraitementPermethrin
0.0410657
0.0688180
0.5967286
0.5506886
Average_Speed_Moving
fixed
cond
TraitementPermethrin
-0.0103842
0.0316010
-0.3286040
0.7424550
Traveled_Dist
fixed
cond
TraitementPermethrin
0.5188934
3.5091352
0.1478693
0.8824459
Code
RLS_table2 <- data_glm %>% dplyr::select(loop.list2) %>%# enleve la var binomialemap(~wilcox.test(.x ~ Traitement, data = data_glm))%>%map_dfr(~tidy(., effects ="fixed"), .id ='source')%>%#dplyr::filter(term!="(Intercept)") %>% arrange(p.value) %>%kbl(caption ="Coefficient of Mann-Whitney for each parameters", booktabs = T) %>%kable_styling(full_width = T)RLS_table2
For the time needed to explore 90% of the surface, that could be considered as acclimation of exploration period, a difference between group is only evidenced for proportion of time moving and Average speed. Permethrin exposed individual seems to move more often and faster than individual only exposed to water.
Parameters for 90% of exploration to the end of the recording.
Code
data_temp3 <- data_temp3%>%mutate_if(is.character, as.factor)data_temp3 %>% dplyr::select(loop.list3) %>%# enleve la var binomialemap(~hist(.x), xlab=.x)
#loop.list2 <- names(data_temp2[, c(9:12,14:18,20,21,29)])RLS_table_3 <- data_temp3 %>% dplyr::select(loop.list3[-1]) %>%# enleve la var binomialemap(~glmmTMB(.x ~ Traitement, data = data_temp3))%>%map_dfr(~tidy(., effects ="fixed"), .id ='source')%>% dplyr::filter(term!="(Intercept)") %>%arrange(p.value) %>%kbl(caption ="Coefficient of linear model for each parameters (90% explo)", booktabs = T) %>%kable_styling(full_width = T)RLS_table_3
Coefficient of linear model for each parameters (90% explo)
source
effect
component
term
estimate
std.error
statistic
p.value
Lseq
fixed
cond
TraitementPermethrin
82.5695830
34.2915280
2.4078712
0.0160458
Average_Speed_Moving
fixed
cond
TraitementPermethrin
-0.0446108
0.0246993
-1.8061572
0.0708938
Meander_moving
fixed
cond
TraitementPermethrin
-28.5424341
30.1041145
-0.9481240
0.3430663
Average_Speed
fixed
cond
TraitementPermethrin
-0.0148152
0.0187485
-0.7902059
0.4294075
Exploration_absolute_value
fixed
cond
TraitementPermethrin
0.0555313
0.0765038
0.7258634
0.4679225
Traveled_Dist_Moving
fixed
cond
TraitementPermethrin
-29.2923343
62.3497095
-0.4698071
0.6384929
Traveled_Dist
fixed
cond
TraitementPermethrin
-24.5269235
65.0602430
-0.3769879
0.7061826
Code
RLS_table3b <- data_temp3 %>% dplyr::select(loop.list3) %>%# enleve la var binomialemap(~wilcox.test(.x ~ Traitement, data = data_temp3))%>%map_dfr(~tidy(., effects ="fixed"), .id ='source')%>%#dplyr::filter(term!="(Intercept)") %>% arrange(p.value) %>%kbl(caption ="Coefficient of Mann-Whitney for each parameters", booktabs = T) %>%kable_styling(full_width = T)RLS_table3b
In this part are presented metrics for only the period taken to explore 90% of the area. As previously, individual with more than 20% of time lost are removed.
library(glmmTMB)library(broom.mixed)data_glm_sp <- data_temp2_sp %>%mutate_if(is.character, as.factor)RLS_table_sp <- data_glm_sp %>% dplyr::select(loop.list2_sp) %>%# enleve la var binomialemap(~wilcox.test(.x ~ Traitement, data = data_glm_sp))%>%map_dfr(~tidy(., effects ="fixed"), .id ='source')%>%#dplyr::filter(term!="(Intercept)") %>% arrange(p.value) %>%kbl(caption ="Coefficient of Mann-Whitney for each parameters", booktabs = T) %>%kable_styling(full_width = T)RLS_table_sp
Coefficient of Mann-Whitney for each parameters
source
statistic
p.value
method
alternative
Time_inside
3728.0
0.4375629
Wilcoxon rank sum test with continuity correction
two.sided
Prop_time_moving
3249.5
0.4518712
Wilcoxon rank sum test with continuity correction
two.sided
Average_Speed
3261.0
0.4743129
Wilcoxon rank sum test with continuity correction
two.sided
Traveled_Dist
3667.0
0.5612223
Wilcoxon rank sum test with continuity correction
two.sided
Nb_entries
3627.0
0.6502245
Wilcoxon rank sum test with continuity correction
two.sided
Traveled_Dist_Moving
3577.0
0.7695876
Wilcoxon rank sum test with continuity correction
two.sided
Exploration_absolute_value
3408.0
0.8065276
Wilcoxon rank sum test with continuity correction
two.sided
Prop_time_inside
3552.0
0.8314181
Wilcoxon rank sum test with continuity correction
two.sided
Meander_moving
3436.0
0.8766159
Wilcoxon rank sum test with continuity correction
two.sided
Latency
3499.0
0.9654701
Wilcoxon rank sum test with continuity correction
two.sided
Average_Speed_moving
3496.0
0.9731857
Wilcoxon rank sum test with continuity correction
two.sided
90% exploration to the end in border zone
Code
data_glm_sp3 <- data_temp3_sp %>%mutate_if(is.character, as.factor)RLS_table3_sp <- data_glm_sp3 %>% dplyr::select(loop.list2_sp) %>%# enleve la var binomialemap(~wilcox.test(.x ~ Traitement, data = data_glm_sp3))%>%map_dfr(~tidy(., effects ="fixed"), .id ='source')%>%#dplyr::filter(term!="(Intercept)") %>% arrange(p.value) %>%kbl(caption ="Coefficient of Mann-Whitney for each parameters", booktabs = T) %>%kable_styling(full_width = T)RLS_table3_sp
Coefficient of Mann-Whitney for each parameters
source
statistic
p.value
method
alternative
Average_Speed
4178.0
0.1819176
Wilcoxon rank sum test with continuity correction
two.sided
Traveled_Dist_Moving
4062.0
0.3258279
Wilcoxon rank sum test with continuity correction
two.sided
Traveled_Dist
4049.0
0.3456462
Wilcoxon rank sum test with continuity correction
two.sided
Average_Speed_moving
4031.0
0.3743271
Wilcoxon rank sum test with continuity correction
two.sided
Nb_entries
4024.0
0.3858623
Wilcoxon rank sum test with continuity correction
two.sided
Latency
4011.5
0.4035998
Wilcoxon rank sum test with continuity correction
two.sided
Meander_moving
3967.0
0.4876741
Wilcoxon rank sum test with continuity correction
two.sided
Prop_time_moving
3665.0
0.8257146
Wilcoxon rank sum test with continuity correction
two.sided
Exploration_absolute_value
3674.0
0.8468037
Wilcoxon rank sum test with continuity correction
two.sided
Prop_time_inside
3796.0
0.8613608
Wilcoxon rank sum test with continuity correction
two.sided
Time_inside
3723.0
0.9648724
Wilcoxon rank sum test with continuity correction
two.sided
For movement around the border, any significant difference between groups have been evidenced for all parameters tested. I choose to apply only wilcoxon as data do not fit gaussian distrib.
Multivariate analysis
I apply mutlivariate analysis only on all zone exploration.
# drop absurd values of meander (pb of parameter estimation to check)df_ACPb<- data_temp2 %>%filter(Meander<10000) %>%select(c(all_of(loop.list2),"Traitement", "sexe")) %>%mutate_if(is.character, as.factor)df_ACPb %>%plot()
fviz_pca_var(pca1, col.var="contrib",gradient.cols =c("#00AFBB", "#E7B800", "#FC4E07"),repel =TRUE# Avoid text overlapping )
Code
fviz_pca_var(pca1b, col.var="contrib",gradient.cols =c("#00AFBB", "#E7B800", "#FC4E07"),repel =TRUE# Avoid text overlapping )
Code
fviz_pca_var(pca3, col.var="contrib",gradient.cols =c("#00AFBB", "#E7B800", "#FC4E07"),repel =TRUE# Avoid text overlapping )
Separation by treatment
Individual representation :
Code
fviz_pca_ind(pca1,label ="none", # hide individual labelshabillage = df_ACP$Traitement, # color by groupspalette =c("#00AFBB", "#FC4E07"),addEllipses =TRUE# Concentration ellipses )
Code
fviz_pca_ind(pca1b,label ="none", # hide individual labelshabillage = df_ACPb$Traitement, # color by groupspalette =c("#00AFBB", "#FC4E07"),addEllipses =TRUE# Concentration ellipses )
Code
fviz_pca_ind(pca3,label ="none", # hide individual labelshabillage = df_ACP3$Traitement, # color by groupspalette =c("#00AFBB", "#FC4E07"),addEllipses =TRUE# Concentration ellipses )
Separation by sexe
Code
fviz_pca_ind(pca1,label ="none", # hide individual labelshabillage = df_ACP$sexe, # color by groupspalette =c("#00AFBB", "#FC4E07"),addEllipses =TRUE# Concentration ellipses )
Code
fviz_pca_ind(pca1b,label ="none", # hide individual labelshabillage = df_ACPb$sexe, # color by groupspalette =c("#00AFBB", "#FC4E07"),addEllipses =TRUE# Concentration ellipses )
Code
fviz_pca_ind(pca3,label ="none", # hide individual labelshabillage = df_ACP3$sexe, # color by groupspalette =c("#00AFBB", "#FC4E07"),addEllipses =TRUE# Concentration ellipses )
Interpretation of ACP results :
I retrieve some absurd values (extremely high values) to improve ACP results for 1 hours recording analysis.
Insecticides effect : The insecticide seems not be involved in movement modification with parameter used here.
Description of the movement : for 1 hour recording, it seems that the movement could be divided mainly by the 1st axe that could be resumed by proportion in movement, speed and distance traveled and 2nd axes mainly consider the meander of the movement.
In summary, lazy, sinuous and slow movement vs active, straight and fast movement.
The analysis of navigation of larvae with parameters bring some informations about the characterisation of this type of behaviour. In addition, we could apply classic comparative statistical analysis that allow to compare parameters between groups. Nevertheless, parameters used before are based on a priori/hypothesis of the navigation decomposition and parameters of interest that described the navigation but some information could be hidden besides the time series represented by the position of the larvae during 1hour. Application of data-driven analysis could highlight some properties of navigation strategy of larvae hidden until now. We propose to apply hidden markov model or activity clustering methods to characterise trajectory based on all data set along time.
Source Code
---title: "Metrics Visualisation and analysis on individuals video+LAM"#subtitle: Part III - Tuberculosis Preventive Treatment Managementauthor: "Angelique Porciani"date: last-modifieddate-format: "[Last Updated on] DD MMMM, YYYY"title-block-banner: "#4E598C" format: html: code-fold: true html-math-method: katex code-tools: true self-contained: trueeditor: visualeditor_options: chunk_output_type: consoletoc: trueexecute: warning: false message: false cache: true---```{r}# load package----library(tidyverse)library(patchwork)library(kableExtra)library(gtsummary)library(FactoMineR)library(glmmTMB)library(factoextra)# load data ---- res_by_ind_spatial <-read.delim("../Data_larvae/data_larves_1hr/Results/Spatial/Element_Tous_bords_0.csv", ,sep =";") %>%separate(Video, c("Camera", "FPS", "Replicat"), remove=FALSE)res_by_ind <-read.delim("../Data_larvae/data_larves_1hr/Results/Results_by_ind.csv", ,sep =";") %>%separate(Video, c("Camera", "FPS", "Replicat"), remove=FALSE) %>%select(!c(25:29))corres_ID <-read_csv2("../Corr_coord_data/corres_Arena_ID.csv") %>%select(c(1,2))corres_ttmt <-read_csv2("../corr_traitement_plaque.csv")%>%select(c(1:4))## ID attribution corres_ID <- corres_ID %>%mutate(Arena=as.numeric(str_extract(Arena, "\\d.*")))res_by_ind <- res_by_ind %>%inner_join(corres_ID) res_by_ind <- res_by_ind %>%mutate(Plaque=as.numeric(str_extract(ID, "\\d+"))) %>%inner_join(corres_ttmt) %>%mutate(End_seq_min=as.numeric(End_seq)/60) %>%mutate(fullID =str_c(Camera, Replicat, ID))res_by_ind_spatial <- res_by_ind_spatial %>%inner_join(corres_ID) res_by_ind_spatial <- res_by_ind_spatial %>%mutate(Plaque=as.numeric(str_extract(ID, "\\d+"))) %>%inner_join(corres_ttmt)%>%mutate(fullID =str_c(Camera, Replicat, ID))# taille des larves taille_larv <-read.csv("../Data_larvae/20240820_mesures_larves.csv")# metadata metadata <-read_csv2("../Data_larvae/20240807_meta_data.csv")metadata <- metadata %>%separate(ID, c("Camera", "ID2")) metadata <- metadata %>%mutate(Camera=str_to_lower(Camera), fullID=paste0(Camera,ID2))# tri des id qui sont en LAM # suppresion des ID qui sont pas dans les LAM et virer le replicat 05metadata_sub <- metadata %>%drop_na(position_LAM) %>%filter(replicat!=5)data_LAM_vid_spatial <-inner_join(metadata_sub, res_by_ind_spatial)data_LAM_vid <-inner_join(metadata_sub, res_by_ind, by=c("Camera","fullID"))data_LAM_vid <- data_LAM_vid %>%mutate(fullID2=paste0(Arena, fullID)) %>%mutate(fullID3=gsub("[^0-9]", "", as.character(fullID2)))res_bout_Mspeed<-read_csv("../Data_larvae/data_larves_1hr/res_bouts_Mspeed.csv") %>% dplyr::select(!1) %>%mutate_at(vars(Max_bout_activ, Max_bout_inactiv, Max_Speed), as.numeric)data_LAM_vid <-data_LAM_vid %>%inner_join(res_bout_Mspeed)```Ce script présente les analyses concernant les données video acquise dans le cadre du projet ANR INDeed. Les analyses sont ici basée sur tous les individus filmé dont la proportion de temps de tracking perdu est inférieur à 20% et qui dont l'activité en LAM a pu être enregistrée.# Video acquisitionThe video were acquiried with a setup described in detail in supplementary data. Basically, it is based on RapsberryPi 4 and a camera IR cut with an objective of 2.8cm focus. Image are acquired at 10fps rate.# Video tracking parametersAll the tracking was made using AnimalTA software (source). The step of plate installation was removed from the video. The length of the video was limited to 3600 s for each replicate. Relative background substraction method was applied (hungarian algo I think, need to validate this). Arena were defined by hand.Parameters needed to do the tracking with the software :- color correction : none, keep original color.- correction of light : yes- Threshold : 19-30 depending on the video- Background : relative background substraction with individual darker than background.- Max distance : 3.5-3.7 cm- Erosion/dilatation : 0- Surface : 56.8cm2- Nb ID by arena : 1# Analysis## Analysis descriptionThis document contains a description of the video data of larvae Anopheles gambiae s.s. kdr mutant L3-L4 stage.Analysis are based on parameters that described the navigatory behaviour of larvae during 1 hour in a circle containers (3cm diameter). Analysis was made on 3 sequences : 1/ complete 1 hour, 2/ time needed to explore 90% of the surface and 3/ 90% of exploration to the end of recording (3600s). All video were cropped to have the same time lenght.Analysis is divided in two mains parts :\- Analysis of results of navigation in the total of the container surface\- Analysis of results in the surface close to border (1 cm to the border).## Number of individuals```{r}data_LAM_vid%>%filter(Sequence=="General") %>%drop_na(traitement) %>%group_by(traitement) %>%summarise(Nmosquitoes=n()) %>%kbl(caption ="Number of mosquitoes larvae tracked and LAM acquisition for each treatment", booktabs = T)%>%kable_styling(full_width = T)data_LAM_vid%>%filter(Sequence=="General"& Prop_time_lost <0.20) %>%group_by(traitement) %>%summarise(Nmosquitoes=n()) %>%kbl(caption ="Number of mosquitoes with less than 20% of time lost during tracking and LAM acquisition for each treatment", booktabs = T)%>%kable_styling(full_width = T)data_LAM_vid %>%filter(Sequence=="General"& Prop_time_lost <0.20) %>%group_by(Replicat, Traitement) %>%summarise(Nmosquitoes=n()) %>%kbl(caption ="Number of mosquitoes with less than 20% of time lost during tracking for each replicate and treatment", booktabs = T)%>%kable_styling(full_width = T)# data_LAM_vid %>% filter(Sequence=="General" & Prop_time_lost < 0.20) %>% # dplyr::select(Replicat, Traitement, fullID3) %>% # # kbl(caption = "Number of mosquitoes with less than 20% of time lost during tracking for each replicate and treatment", booktabs = T)%>%# #kable_styling(full_width = T) %>% # data_frame() %>% # write.csv("../ID_selected_MoveR.csv")data_LAM_vid%>%filter(Sequence=="General"& Prop_time_lost <0.20) %>%group_by(Traitement, sexe) %>%summarise(Nmosquitoes=n()) %>%kbl(caption ="Number of mosquitoes with less than 20% of time lost during tracking for each replicate and treatment", booktabs = T)%>%kable_styling(full_width = T)```## Number of individual alive until LAM for each treatement and replicate```{r}# estimation of number alive until LAM for water and permethrin exposition metadata %>% dplyr::filter(replicat!=5& replicat!=7) %>% dplyr::group_by(replicat,traitement) %>% dplyr::filter(LAMetsurv==1) %>%summarise(n=n()) %>%kbl(caption ="Number of mosquitoes alive until LAM recording", booktabs = T)%>%kable_styling(full_width = T)```## Variables descriptionParameters are calculated for all displacement inside the containers (named after dataset_all) and inside the zone defined along border of each containers (spatial). I choose a zone of 1cm to the border. Graphics and analysis were presented for each set of parameters (all or spatial).Threshold for movement : Here the threshold is defined as the distance traveled between two frames higher than 0.3cm corresponding to the L3_L4 larvae body size.| Variable Name | Description | Units | Type of bhvr | Dataset ||-------------|-----------------------|-------------|-------------|-------------|| Prop_time_lost | Count the proportion of frames for which the target was not detected (appears as “NA NA” in the data tables). | No units | NA | Both || Average_Speed | The displacement speed between each frame will be calculated and averaged for the whole video/or sequence length defined. | cm/frame | activity | Both || Average_Speed_Moving | The displacement speed between each frame where the target is considered as moving (i.e. speed above the red movement threshold) will be calculated and averaged for the whole video. | cm/frame | | Both || Prop_time_moving | Proportion of time the target is considered as moving given the defined threshold. | No units | activity | Both || Traveled_Dist | Sum the total distance traveled by the target. | cm | activity/exploration | Both || Traveled_Dist_Moving | Sum the total distance traveled by the target when we only consider the frame during which the target is considered as moving. | cm | activity. | Both || End_seq | Time needed to explore 90% of the surface. Length of the sequence. (Manually defined, other option are available in AnimalTA software). (s) | second | exploration | Ind_all || Prop_time_inside | Proportion of time inside the area, here in an area of 3mm along border. | No units | foraging | Spatial || Time_inside | Number of frame (s?) inside 3mm close to border. | seconds ? | foraging | Spatial || Nb_entries | Nb of the entries in the area of 3mm close to border | No units | foraging | Spatial || Exploration_absolute_value | surface in cm2 explored by the larvae in a given time (here 1 hour or End_seq time length). | cm2 | exploration (time dependant)/ not really relevant for our study as we let enough time given the container to explore all the surface | ind_all || Meander | Indicator of the sinusoity of the trajectories during the sequence recorded. Estimation of the meander of the trajectories. This value is the average of the change in direction (turning angle) divided by the distance traveled for each frame. | | foraging | Both || Meander_moving | same as Meander but only for movement | | Foraging ? | Both || Latency | The latency to approach the border(s) at less than the indicated distance (1cm here) | | Rest ? | Spatial || Max_bout_inactiv | Maximal length (in frame) without movement \>0.3cm/s | | physiological/activity intensity | ind_all || Max_speed | Maximal speed recorded (cm/s) | | physiological/activity intensity | ind_all |: Variables descriptionNeed precision about :- The method for speed average ? (moyenne glissante ? geométrique ?)- Units of Time inside frame or second ?All detailed informations are available in software AnimalTA and associated guidelines.## All surface analysis### 1 hour recordingThe data presented are data for the whole recording and for individuals with less than 20% of time lost during recording.```{r}data_temp=subset(data_LAM_vid, Prop_time_lost <0.20& Sequence=="General")loop.list <-c("Prop_time_moving", "Average_Speed", "Average_Speed_Moving", "Traveled_Dist", "Meander", "Traveled_Dist_Moving", "Meander_moving", "Max_bout_inactiv", "Max_Speed")plot_list <-list()for (n in loop.list) { plot_list[[n]] <-ggplot(data=data_temp)+geom_jitter(aes_string(x="Traitement", y=n, color="Traitement")) +geom_boxplot(aes_string(x="Traitement", y=n, color="Traitement"), width =0.15, position =position_dodge(0.9)) +geom_violin(aes_string(x="Traitement", y=n,fill ="Traitement",colour="Traitement"),alpha=0.3, linewidth =0) +theme_light()+theme(legend.position ="none", axis.title.x =element_blank())+ylab(paste(n))+scale_color_manual(values =c("#648FFF", "#FE6100"))+scale_fill_manual(values =c("#648FFF", "#FE6100"))#print(plot_list[[n]])}wrap_plots(plot_list[1:6], nrow=3)wrap_plots(plot_list[7:9], nrow=2)# Table of mean, sd and median data_temp %>%tbl_summary(include = loop.list,by=Traitement,type = loop.list ~"continuous2",statistic =all_continuous2() ~c("{median} ({p25} - {p75}", "{mean} ({sd})"),digits =list(all_continuous2() ~2) )```### 90% explorationIn this part are presented metrics for only the period taken to explore 90% of the area. As previously, individual with more than 20% of time lost are removed.```{r}data_temp2 <- data_LAM_vid %>%filter(Prop_time_lost <0.20& Sequence =="Seq_90")loop.list2 <-c("Prop_time_moving", "Traveled_Dist", "Traveled_Dist_Moving", "Average_Speed", "Average_Speed_Moving", "Meander_moving", "Exploration_absolute_value", "End_seq")plot_list <-list()for (n in loop.list2){ plot_list[[n]] <-ggplot(data_temp2)+geom_jitter(aes_string(x="Traitement", y=n, color="Traitement")) +geom_boxplot(aes_string(x="Traitement", y=n, color="Traitement"), width =0.15, position =position_dodge(0.9)) +geom_violin(aes_string(x="Traitement", y=n,fill ="Traitement",colour="Traitement"),alpha=0.3, linewidth =0) +theme_light()+theme(legend.position ="none")+ylab(paste(n))+scale_color_manual(values =c("#648FFF", "#FE6100"))+scale_fill_manual(values =c("#648FFF", "#FE6100"))#print(plot_list[[n]])}wrap_plots(plot_list[1:4], nrow=2)wrap_plots(plot_list[5:8], nrow=2)data_temp2 %>%tbl_summary(include = loop.list2,by=Traitement,type = loop.list2 ~"continuous2",statistic =all_continuous2() ~c("{median} ({p25} - {p75}", "{mean} ({sd})"),digits =list(all_continuous2() ~2) )```### 90% exploration to the end of recording```{r}data_temp3 <- data_LAM_vid %>%filter(Prop_time_lost <0.20& Sequence =="Seq_all") %>%mutate(Lseq=End_seq-Beginning_seq)loop.list3 <-c("Prop_time_moving", "Traveled_Dist", "Traveled_Dist_Moving", "Average_Speed", "Average_Speed_Moving", "Meander_moving", "Exploration_absolute_value", "Lseq")# loop.list3 <- c("Latency", "Prop_time_inside", "Time_inside", "Nb_entries", "Prop_time_moving", "Traveled_Dist", "Traveled_Dist_Moving", "Average_Speed", "Average_Speed_moving", # "Meander_moving", "Exploration_absolute_value", "Lseq")plot_list <-list()for (n in loop.list3){ plot_list[[n]] <-ggplot(data_temp3)+geom_jitter(aes_string(x="Traitement", y=n, color="Traitement")) +geom_boxplot(aes_string(x="Traitement", y=n, color="Traitement"), width =0.15, position =position_dodge(0.9)) +geom_violin(aes_string(x="Traitement", y=n,fill ="Traitement",colour="Traitement"),alpha=0.3, linewidth =0) +theme_light()+theme(legend.position ="none")+ylab(paste(n))+scale_color_manual(values =c("#648FFF", "#FE6100"))+scale_fill_manual(values =c("#648FFF", "#FE6100"))#print(plot_list[[n]])}wrap_plots(plot_list[1:4], nrow=2)wrap_plots(plot_list[5:8], nrow=2)data_temp3 %>%tbl_summary(include = loop.list3,by=Traitement,type = loop.list3 ~"continuous2",statistic =all_continuous2() ~c("{median} ({p25} - {p75}", "{mean} ({sd})"),digits =list(all_continuous2() ~2) )```### Univariate analysisAnalysis of impact of permethrin exposition on each parameters calculated.#### Parameters 90% explorationParameters that we can consider they follow a gaussian (approx) for parameters extracted from 90% needed to explore environement. Given the mean estimation and SD, statistical test are almost not needed to confirm that there are no difference between groups. I have just done lm or glm for code simplicity, but classic t-test or equivalent are also an option.```{r}library(glmmTMB)library(broom.mixed)data_glm <- data_temp2 %>%mutate_if(is.character, as.factor)data_glm %>% dplyr::select(loop.list2[-1]) %>%# enleve la var binomialemap(~hist(.x), xlab=.x)RLS_table <- data_glm %>% dplyr::select(loop.list2[-1]) %>%# enleve la var binomialemap(~glmmTMB(.x ~ Traitement, data = data_glm))%>%map_dfr(~tidy(., effects ="fixed"), .id ='source')%>% dplyr::filter(term!="(Intercept)") %>%arrange(p.value) %>%kbl(caption ="Coefficient of linear model for each parameters", booktabs = T) %>%kable_styling(full_width = T)RLS_tableRLS_table2 <- data_glm %>% dplyr::select(loop.list2) %>%# enleve la var binomialemap(~wilcox.test(.x ~ Traitement, data = data_glm))%>%map_dfr(~tidy(., effects ="fixed"), .id ='source')%>%#dplyr::filter(term!="(Intercept)") %>% arrange(p.value) %>%kbl(caption ="Coefficient of Mann-Whitney for each parameters", booktabs = T) %>%kable_styling(full_width = T)RLS_table2```Binomial variable : prop_time moving```{r}# glm PTM <-glmmTMB(Prop_time_moving~Traitement, data=data_glm, family=binomial(link ="logit"))summary(PTM)```For the time needed to explore 90% of the surface, that could be considered as acclimation of exploration period, a difference between group is only evidenced for proportion of time moving and Average speed. Permethrin exposed individual seems to move more often and faster than individual only exposed to water.#### Parameters for 90% of exploration to the end of the recording.```{r}data_temp3 <- data_temp3%>%mutate_if(is.character, as.factor)data_temp3 %>% dplyr::select(loop.list3) %>%# enleve la var binomialemap(~hist(.x), xlab=.x)#loop.list2 <- names(data_temp2[, c(9:12,14:18,20,21,29)])RLS_table_3 <- data_temp3 %>% dplyr::select(loop.list3[-1]) %>%# enleve la var binomialemap(~glmmTMB(.x ~ Traitement, data = data_temp3))%>%map_dfr(~tidy(., effects ="fixed"), .id ='source')%>% dplyr::filter(term!="(Intercept)") %>%arrange(p.value) %>%kbl(caption ="Coefficient of linear model for each parameters (90% explo)", booktabs = T) %>%kable_styling(full_width = T)RLS_table_3RLS_table3b <- data_temp3 %>% dplyr::select(loop.list3) %>%# enleve la var binomialemap(~wilcox.test(.x ~ Traitement, data = data_temp3))%>%map_dfr(~tidy(., effects ="fixed"), .id ='source')%>%#dplyr::filter(term!="(Intercept)") %>% arrange(p.value) %>%kbl(caption ="Coefficient of Mann-Whitney for each parameters", booktabs = T) %>%kable_styling(full_width = T)RLS_table3b```Prop time moving :```{r}PTM2 <-glmmTMB(Prop_time_moving~Traitement, data=data_temp3, family=binomial(link ="logit"))summary(PTM2)```## Border zone analysis### 90 % explorationIn this part are presented metrics for only the period taken to explore 90% of the area. As previously, individual with more than 20% of time lost are removed.```{r}data_temp2_sp <- data_LAM_vid_spatial %>%filter(Prop_time_lost <0.20& Sequence =="Seq_90")loop.list2_sp <-c("Latency", "Prop_time_inside", "Time_inside", "Nb_entries", "Prop_time_moving", "Traveled_Dist", "Traveled_Dist_Moving", "Average_Speed", "Average_Speed_moving","Meander_moving", "Exploration_absolute_value")plot_list <-list()for (n in loop.list2_sp){ plot_list[[n]] <-ggplot(data_temp2_sp)+geom_jitter(aes_string(x="Traitement", y=n, color="Traitement")) +geom_boxplot(aes_string(x="Traitement", y=n, color="Traitement"), width =0.15, position =position_dodge(0.9)) +geom_violin(aes_string(x="Traitement", y=n,fill ="Traitement",colour="Traitement"),alpha=0.3, linewidth =0) +theme_light()+theme(legend.position ="none")+ylab(paste(n))+scale_color_manual(values =c("#648FFF", "#FE6100"))+scale_fill_manual(values =c("#648FFF", "#FE6100"))#print(plot_list[[n]])}wrap_plots(plot_list[1:6], nrow=2)wrap_plots(plot_list[7:11], nrow=2)data_temp2_sp %>%tbl_summary(include = loop.list2_sp,by=Traitement,type = loop.list2_sp ~"continuous2",statistic =all_continuous2() ~c("{median} ({p25} - {p75}", "{mean} ({sd})"),digits =list(all_continuous2() ~2) )```### 90% exploration to the end of recording```{r}data_temp3_sp <- data_LAM_vid_spatial %>%filter(Prop_time_lost <0.20& Sequence =="Seq_all")plot_list <-list()for (n in loop.list2_sp){ plot_list[[n]] <-ggplot(data_temp3_sp)+geom_jitter(aes_string(x="Traitement", y=n, color="Traitement")) +geom_boxplot(aes_string(x="Traitement", y=n, color="Traitement"), width =0.15, position =position_dodge(0.9)) +geom_violin(aes_string(x="Traitement", y=n,fill ="Traitement",colour="Traitement"),alpha=0.3, linewidth =0) +theme_light()+theme(legend.position ="none")+ylab(paste(n))+scale_color_manual(values =c("#648FFF", "#FE6100"))+scale_fill_manual(values =c("#648FFF", "#FE6100"))#print(plot_list[[n]])}wrap_plots(plot_list[1:6], nrow=2)wrap_plots(plot_list[7:11], nrow=2)data_temp3_sp %>%tbl_summary(include = loop.list2_sp,by=Traitement,type = loop.list2_sp ~"continuous2",statistic =all_continuous2() ~c("{median} ({p25} - {p75}", "{mean} ({sd})"),digits =list(all_continuous2() ~2) )```### Univariate analysis#### 90% exploration in border zone```{r}library(glmmTMB)library(broom.mixed)data_glm_sp <- data_temp2_sp %>%mutate_if(is.character, as.factor)RLS_table_sp <- data_glm_sp %>% dplyr::select(loop.list2_sp) %>%# enleve la var binomialemap(~wilcox.test(.x ~ Traitement, data = data_glm_sp))%>%map_dfr(~tidy(., effects ="fixed"), .id ='source')%>%#dplyr::filter(term!="(Intercept)") %>% arrange(p.value) %>%kbl(caption ="Coefficient of Mann-Whitney for each parameters", booktabs = T) %>%kable_styling(full_width = T)RLS_table_sp```#### 90% exploration to the end in border zone```{r}data_glm_sp3 <- data_temp3_sp %>%mutate_if(is.character, as.factor)RLS_table3_sp <- data_glm_sp3 %>% dplyr::select(loop.list2_sp) %>%# enleve la var binomialemap(~wilcox.test(.x ~ Traitement, data = data_glm_sp3))%>%map_dfr(~tidy(., effects ="fixed"), .id ='source')%>%#dplyr::filter(term!="(Intercept)") %>% arrange(p.value) %>%kbl(caption ="Coefficient of Mann-Whitney for each parameters", booktabs = T) %>%kable_styling(full_width = T)RLS_table3_sp```For movement around the border, any significant difference between groups have been evidenced for all parameters tested. I choose to apply only wilcoxon as data do not fit gaussian distrib.## Multivariate analysisI apply mutlivariate analysis only on all zone exploration.### Relation between co-variable### Correlation```{r}library(corrplot)col <-colorRampPalette(c("#BB4444", "#EE9988", "#FFFFFF", "#77AADD", "#4477AA"))data_LAM_vid %>%filter(Sequence=="General") %>%select(all_of(loop.list)) %>%cor() %>%corrplot(method="color", col=col(200),type="upper", order="hclust")data_temp2 %>%filter(Sequence=="Seq_90") %>%select(all_of(loop.list2)) %>%cor() %>%corrplot(method="color", col=col(200),type="upper",order="hclust")data_temp3 %>%filter(Sequence=="Seq_all") %>%select(all_of(loop.list3)) %>%cor() %>%corrplot(method="color", col=col(200),type="upper", order="hclust")```### ACP1st graph : 90% of exploration. 2nd graph : 90% of exploration without outlier values of meander 3tr graph : 90% to the end.Co variable relation.```{r}library(corrplot)df_ACP<- data_temp2 %>%select(c(all_of(loop.list2),"Traitement", "sexe")) %>%mutate_if(is.character, as.factor)df_ACP %>%plot()# drop absurd values of meander (pb of parameter estimation to check)df_ACPb<- data_temp2 %>%filter(Meander<10000) %>%select(c(all_of(loop.list2),"Traitement", "sexe")) %>%mutate_if(is.character, as.factor)df_ACPb %>%plot()df_ACP3<- data_temp3 %>%select(c(all_of(loop.list3),"Traitement", "sexe")) %>%mutate_if(is.character, as.factor)df_ACP3 %>%plot()pca1<-PCA(df_ACP[,-c(9,10)], graph=FALSE)pca1b<-PCA(df_ACPb[,-c(9,10)], graph=FALSE)pca3<-PCA(df_ACP3[,-c(9,10)], graph=FALSE)# ACP1 <- res_by_ind %>% filter(Sequence=="General"& Prop_time_lost<0.2) %>% select(c(all_of(loop.list),"Traitement")) %>% # mutate_if(is.character, as.factor) %>% PCA()#ACP2<- res_by_ind_spatial %>% filter(Sequence=="Seq_0" & Prop_time_lost<0.2) %>% select(all_of(loop.list2)) %>% PCA()``````{r}fviz_eig(pca1, addlabels =TRUE) res <-get_pca_var(pca1)corrplot(res$cos2)fviz_eig(pca1b, addlabels =TRUE) res2 <-get_pca_var(pca1b)corrplot(res2$cos2)fviz_eig(pca3, addlabels =TRUE) res3 <-get_pca_var(pca3)corrplot(res3$cos2)```Variable representation :```{r}fviz_pca_var(pca1, col.var="contrib",gradient.cols =c("#00AFBB", "#E7B800", "#FC4E07"),repel =TRUE# Avoid text overlapping )fviz_pca_var(pca1b, col.var="contrib",gradient.cols =c("#00AFBB", "#E7B800", "#FC4E07"),repel =TRUE# Avoid text overlapping )fviz_pca_var(pca3, col.var="contrib",gradient.cols =c("#00AFBB", "#E7B800", "#FC4E07"),repel =TRUE# Avoid text overlapping )```#### Separation by treatmentIndividual representation :```{r}fviz_pca_ind(pca1,label ="none", # hide individual labelshabillage = df_ACP$Traitement, # color by groupspalette =c("#00AFBB", "#FC4E07"),addEllipses =TRUE# Concentration ellipses )fviz_pca_ind(pca1b,label ="none", # hide individual labelshabillage = df_ACPb$Traitement, # color by groupspalette =c("#00AFBB", "#FC4E07"),addEllipses =TRUE# Concentration ellipses )fviz_pca_ind(pca3,label ="none", # hide individual labelshabillage = df_ACP3$Traitement, # color by groupspalette =c("#00AFBB", "#FC4E07"),addEllipses =TRUE# Concentration ellipses )```#### Separation by sexe```{r}fviz_pca_ind(pca1,label ="none", # hide individual labelshabillage = df_ACP$sexe, # color by groupspalette =c("#00AFBB", "#FC4E07"),addEllipses =TRUE# Concentration ellipses )fviz_pca_ind(pca1b,label ="none", # hide individual labelshabillage = df_ACPb$sexe, # color by groupspalette =c("#00AFBB", "#FC4E07"),addEllipses =TRUE# Concentration ellipses )fviz_pca_ind(pca3,label ="none", # hide individual labelshabillage = df_ACP3$sexe, # color by groupspalette =c("#00AFBB", "#FC4E07"),addEllipses =TRUE# Concentration ellipses )```Interpretation of ACP results :I retrieve some absurd values (extremely high values) to improve ACP results for 1 hours recording analysis.Insecticides effect : The insecticide seems not be involved in movement modification with parameter used here.Description of the movement : for 1 hour recording, it seems that the movement could be divided mainly by the 1st axe that could be resumed by proportion in movement, speed and distance traveled and 2nd axes mainly consider the meander of the movement.In summary, lazy, sinuous and slow movement vs active, straight and fast movement.The analysis of navigation of larvae with parameters bring some informations about the characterisation of this type of behaviour. In addition, we could apply classic comparative statistical analysis that allow to compare parameters between groups. Nevertheless, parameters used before are based on a priori/hypothesis of the navigation decomposition and parameters of interest that described the navigation but some information could be hidden besides the time series represented by the position of the larvae during 1hour. Application of data-driven analysis could highlight some properties of navigation strategy of larvae hidden until now. We propose to apply hidden markov model or activity clustering methods to characterise trajectory based on all data set along time.